package com.ruoyi.project.system.uflo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.bstek.uflo.model.ProcessInstance;
import com.bstek.uflo.service.ProcessService;
import com.bstek.uflo.service.StartProcessInfo;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.user.domain.User;

/**
 * 流程
 * @author xianz
 *
 */
@Controller
@RequestMapping("/ufloProcess")
public class UfloProcessController extends BaseController{

	@Autowired
	ProcessService processService;
	
	/**
	 * 开启流程
	 * @param processId
	 * @param businessId
	 * @return
	 */
	@PostMapping("/startProcess")
	public AjaxResult startProcess(Long processId, Long businessId) {
		User user = getSysUser();
        StartProcessInfo info=new StartProcessInfo(user.getUserId().toString());
        info.setBusinessId(businessId.toString());
        ProcessInstance processInstance = processService.startProcessById(processId, info);
		return success();
	}
	
}
